package com.jgraves.WikiToSpeech;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/** Collection of general purpose functions
 * @author johngraves
 *
 */
public class Library {

	// -----------------------
	public static void print(Object obj){
		System.out.println(obj.toString());
	}

	// ---------------------
	/** Update shared preferences from State */
	public static void savePreferences(Context context) {
		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
		SharedPreferences.Editor editor = prefs.edit();
		editor.putBoolean("silentMode", State.isSilentMode());
		editor.putString("language", State.getLanguage());
		print("Preference for silent mode saved as: " + State.isSilentMode());
		editor.commit();
	}

}
